<template>
	<view class="main">
		<view class="card-bot">
			<view class="nav-item" @click="toRouter('/setting/edit_user')">
				<view class="left">

					<text>修改个人信息</text>
				</view>

				<u-icon name="arrow-right" color="#333" size="16"></u-icon>
			</view>
			<view class="nav-item" @click="toRouter('/setting/authorize')">
				<view class="left">

					<text>系统授权</text>
				</view>

				<u-icon name="arrow-right" color="#333" size="16"></u-icon>
			</view>

		</view>
		<view class="btn-logout" @click="logOut">
			退出登录
		</view>
	</view>
</template>

<script>
	export default {
		methods: {
			toRouter(item) {
				uni.navigateTo({
					url: item
				})
			},
			logOut() {
				uni.showModal({
					title: '提示',
					content: '是否退出登录？',
					showCancel: true, // 是否显示取消按钮
					cancelText: '取消', // 取消按钮的文字
					cancelColor: '#000000', // 取消按钮的颜色
					confirmText: '确定', // 确定按钮的文字
					confirmColor: '#3CC51F', // 确定按钮的颜色
					success: (res1) => {
						if (res1.confirm) {
							uni.removeStorageSync('token')
							uni.removeStorageSync('user')
							uni.removeStorageSync('car')
							uni.removeStorageSync('choseCar')
							uni.removeStorageSync('storeList')
							uni.removeStorageSync('shopId')
							uni.removeStorageSync('choseShop')
							uni.navigateTo({
								url: "/pages/login/index"
							})
						} else if (res1.cancel) {
							console.log('用户点击了取消')
						}
					},
					fail: (err) => {
						console.log('调用失败', err);
					}
				});


			}
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		padding: 30rpx 30rpx;
		box-sizing: border-box;
	}

	.card-bot {
		width: 100%;
		min-height: 300rpx;
		background: #fff;
		border-radius: 10rpx;
		// margin-top: -40rpx;

		.nav-item {
			width: 100%;
			height: 80rpx;
			display: flex;
			margin-bottom: 10rpx;
			align-items: center;
			justify-content: space-between;
			color: #333;
			font-size: 28rpx;
			border-bottom: 1rpx solid #f6f6f6;

			.left {
				width: 80%;
				display: flex;
				align-items: center;

				.bto-icon {
					margin-right: 6rpx;
				}
			}

			&:nth-last-child(1) {
				border-bottom: none;
			}
		}
	}

	.btn-logout {
		margin-top: 25rpx;
		width: 100%;
		height: 80rpx;
		background: #ff9900;
		border-radius: 10rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		color: #fff;
	}
</style>